package com.rxmvp.rxmvpdemo.base;

import com.rxmvp.rxmvpdemo.base.mvp.IBasePresenter;
import com.rxmvp.rxmvpdemo.base.mvp.IBaseView;
import com.trello.rxlifecycle.components.ActivityLifecycleProvider;

/**
 * 与RxJava有关的activity的基类presenter，负责获取资源引用和释放资源引用
 *
 * 作者： huangRZ on 2017/1/21. 15:04
 * 邮箱：917647409@qq.com
 */
public abstract class RxBaseActivityPresenter<T extends IBaseView> implements IBasePresenter {

    protected ActivityLifecycleProvider mActivityProvider;
    protected T mView;

    //构造器中的参数实例由其子类构造器提供，其子类的参数实例由dagger中的module提供
    public RxBaseActivityPresenter(T view, ActivityLifecycleProvider activityLifecycleProvider){
        this.mView = view;
        this.mActivityProvider = activityLifecycleProvider;
    }

//    public void setProvider(ActivityLifecycleProvider activityLifecycleProvider){
//        this.mActivityProvider = activityLifecycleProvider;
//    }

    public void onDestroy(){
        mView = null;
        mActivityProvider = null;
    }
}
